<?php 
/*************************************************************
* Do not modify unless you know what you're doing, SERIOUSLY!
*************************************************************/
//load_theme_textdomain('default');
//load_textdomain( 'default', TEMPLATEPATH.'/localization/ar_AE.mo' );

// Theme variables
if ( function_exists( 'add_image_size' ) ) { 
	add_image_size( 'small-thumb', 111, 111, true ); //(cropped)
}
$themename_child = 'StoreBox Child';
define('CHILDTEMPLATEPATH',dirname(__FILE__));
$child_functions_path = CHILDTEMPLATEPATH. '/library/functions/';
require_once (TEMPLATEPATH . '/library/functions/theme_variables.php');
// Theme admin functions
require_once (TEMPLATEPATH . '/admin/admin_functions.php');
// Theme admin options
//require_once ($child_functions_path . 'admin_options.php');
require_once (CHILDTEMPLATEPATH . '/child_language.php');

require_once (CHILDTEMPLATEPATH . '/library/functions/theme_filters.php'); //child theme filters

//load_theme_textdomain('default');
//load_textdomain( 'default', CHILDTEMPLATEPATH.'/en_US.mo' );  //UNCOMMENT THE PHP CODE. ENSURE YOUR LANGUAGE MO FILE IS AT ROOT OF THEME FOLDER AND YOU HAVE CHANGED THE mo FILE NAME IN THIS CODE

if('themes.php' == basename($_SERVER['SCRIPT_FILENAME']) && $_REQUEST['activated']=='true') 
{
	add_action( 'after_setup_theme', 'ecommerce_frmwork_child_setup' );
}
if(!function_exists( 'ecommerce_frmwork_child_setup' ) ){
function ecommerce_frmwork_child_setup()
{
	$dummy_image_path = get_stylesheet_directory_uri().'/images/dummy/';
	update_option("ptthemes_alt_stylesheet",'1-default.css');
	update_option("ptthemes_add_to_cart_button_position",'Below Description');
	update_option("ptthemes_related_prd_single",'Show');
	update_option("ptthemes_related_prd_number",'3');
	update_option("ptthemes_home_design_settings",'With Left Sidebar');
	update_option("ptthemes_inner_design_settings",'With Left Sidebar');
	update_option("ptthemes_product_design_settings",'With Left Sidebar');
	update_option("ptthemes_blog_design_settings",'With Left Sidebar');
	update_option("ptthemes_product_detail_design_settings",'With Left Sidebar');
	update_option("ptthemes_blog_detail_design_settings",'With Left Sidebar');
	update_option("ptthemes_store_design_settings",'With Left Sidebar');
	update_option("ptthemes_cart_design_settings",'With Left Sidebar');
	update_option("ptthemes_checkout_design_settings",'Full page');
	update_option("ptthemes_image_width",'175');
	update_option("ptthemes_image_height",'175');
	update_option("ptthemes_prd_listing_format",'grid');
	update_option("ptthemes_storeprd_number",'12');
	update_option("posts_per_page",'12');
	update_option("ptthemes_prdlisttitle_showhide",'true');
	update_option("ptthemes_prdlisttitle_order",'2');
	update_option("ptthemes_prdlistimage_showhide",'true');
	update_option("ptthemes_prdlistimage_border",'true');
	update_option("ptthemes_prdlistprice_showhide",'true');
	update_option("ptthemes_prdlistprice_order",'3');
	update_option("ptthemes_prdlistcontent_showhide",'true');
	update_option("ptthemes_prdlistcontent_order",'4');
	update_option("ptthemes_prdlistbutton_showhide",'true');
	update_option("ptthemes_prdlistbutton_order",'5');
	update_option("ptthemes_storelink_display",'Show');
	
	/////////////// WIDGET SETTINGS START ///////////////
/*echo "<pre>";
print_r(get_option('sidebars_widgets'));
print_r(get_option('widget_widget_advtwidget'));
exit;*/

$home_slider_info[1] = array(
					"title"				=>	'',
					"category"			=>	'',
					"post_number"		=>	'5',
					"post_link"			=>	'',
					"auto_rotate"		=>	'Yes',
					"speed"				=>	'5000',
					"image_width"		=>	'450',
					"image_height"		=>	'',
					"content_lenght"	=>	'350',
					);
$home_slider_info['_multiwidget'] = '1';

update_option('widget_widget_posts1',$home_slider_info);
$home_slider_widget_info = get_option('widget_widget_posts1');
krsort($home_slider_widget_info);
foreach($home_slider_widget_info as $key1=>$val1)
{
	$home_slider_widget_info_key = $key1;
	if(is_int($home_slider_widget_info_key))
	{
		break;
	}
}
$widget_posts2 = array();
$widget_posts2[1] = array(
					"title"			=>	'',
					"category"		=>	'',
					"advt1"			=>	'<a href="http://www.templatic.com"><img alt="" src="'.$dummy_image_path.'free_shipping.png'.'"></a>',
					);
$widget_posts2['_multiwidget'] = '1';

update_option('widget_widget_posts2',$widget_posts2);
$widget_posts2 = get_option('widget_widget_posts2');
krsort($widget_posts2);
foreach($widget_posts2 as $key1=>$val1)
{
	$widget_posts2_key = $key1;
	if(is_int($widget_posts2_key))
	{
		break;
	}
}
$wp_sidebar_widgets["sidebar-1"] = array("widget_posts1-$home_slider_widget_info_key","widget_posts2-$widget_posts2_key");
$cat_info = array();
$cat_info[1] = array(
					"title"				=>	'Browse By Category',
					);
$cat_info['_multiwidget'] = '1';

update_option('widget_browse_by_cats',$cat_info);
$cat_info = get_option('widget_browse_by_cats');
krsort($cat_info);
foreach($cat_info as $key1=>$val1)
{
	$cat_info_key = $key1;
	if(is_int($cat_info_key))
	{
		break;
	}
}
$special_product = array();
$special_product[1] = array(
					"title"				=>	'',
					"category"			=>	'',
					"post_number"		=>	'2',
					"post_link"			=>	'',
					);
$special_product['_multiwidget'] = '1';
update_option('widget_widget_special_product',$special_product);
$special_product = get_option('widget_widget_special_product');
krsort($special_product);
foreach($special_product as $key1=>$val1)
{
	$special_product_key = $key1;
	if(is_int($special_product_key))
	{
		break;
	}
}
$advtwidget = array();
$advtwidget[1] = array(
					"title"	=>	'',
					"advt1"	=>	'<a href="http://www.templatic.com"><img alt="" src="'.$dummy_image_path.'i-bannerleft.jpg"></a>',
					
					);
$advtwidget['_multiwidget'] = '1';
update_option('widget_widget_advtwidget',$advtwidget);
$advtwidget = get_option('widget_widget_advtwidget');
krsort($advtwidget);
foreach($advtwidget as $key1=>$val1)
{
	$advtwidget_key = $key1;
	if(is_int($advtwidget_key))
	{
		break;
	}
}
$wp_sidebar_widgets["sidebar-2"] = array("browse_by_cats-$cat_info_key","widget_advtwidget-$advtwidget_key");
$latest_info = array();
$latest_info[1] = array(
					"title"				=>	'Latest Products',
					"display_prds_no"	=>	'6',
					"list_type"			=>	'Grid',
					"show_store_link"	=>	'#',
					"image_width"		=>	'170',
					"image_height"		=>	'170',
					);
$latest_info['_multiwidget'] = '1';

update_option('widget_latest_product_info',$latest_info);
$latest_info = get_option('widget_latest_product_info');
krsort($latest_info);
foreach($latest_info as $key1=>$val1)
{
	$latest_info_key = $key1;
	if(is_int($latest_info_key))
	{
		break;
	}
}
$wp_sidebar_widgets["sidebar-3"] = array("latest_product_info-$latest_info_key");
$cat_info = array();
$cat_info = get_option('widget_browse_by_cats');
$cat_info[2] = array(
					"title"				=>	'Browse By Category',
					);
$cat_info['_multiwidget'] = '1';

update_option('widget_browse_by_cats',$cat_info);
$cat_info = get_option('widget_browse_by_cats');
krsort($cat_info);
foreach($cat_info as $key1=>$val1)
{
	$cat_info_key = $key1;
	if(is_int($cat_info_key))
	{
		break;
	}
}
$advtwidget = array();
$advtwidget = get_option('widget_widget_advtwidget');
$advtwidget[2] = array(
					"title"	=>	'',
					"advt1"	=>	'<a href="http://www.templatic.com"><img alt="" src="'.$dummy_image_path.'i-bannerleft.jpg"></a>',
					
					);
$advtwidget['_multiwidget'] = '1';
update_option('widget_widget_advtwidget',$advtwidget);
$advtwidget = get_option('widget_widget_advtwidget');
krsort($advtwidget);
foreach($advtwidget as $key1=>$val1)
{
	$advtwidget_key = $key1;
	if(is_int($advtwidget_key))
	{
		break;
	}
}
$special_product = array();
$special_product = get_option('widget_widget_special_product');
$special_product[2] = array(
					"title"				=>	'',
					"category"			=>	'',
					"post_number"		=>	'2',
					"post_link"			=>	'',
					);
$special_product['_multiwidget'] = '1';
update_option('widget_widget_special_product',$special_product);
$special_product = get_option('widget_widget_special_product');
krsort($special_product);
foreach($special_product as $key1=>$val1)
{
	$special_product_key = $key1;
	if(is_int($special_product_key))
	{
		break;
	}
}
$recent_info = array();
$recent_info[1] = array(
					"title"				=>	'',
					"number"			=>	'5',
					);
$recent_info['_multiwidget'] = '1';

update_option('widget_recent-posts',$recent_info);
$recent_info = get_option('widget_recent-posts');
krsort($recent_info);
foreach($recent_info as $key1=>$val1)
{
	$recent_info_key = $key1;
	if(is_int($recent_info_key))
	{
		break;
	}
}
$wp_sidebar_widgets["sidebar-5"] = array("browse_by_cats-$cat_info_key","widget_advtwidget-$advtwidget_key","widget_special_product-$special_product_key","recent-posts-$recent_info_key");
$cat_info = array();
$cat_info = get_option('widget_browse_by_cats');
$cat_info[3] = array(
					"title"				=>	'Browse By Category',
					);
$cat_info['_multiwidget'] = '1';

update_option('widget_browse_by_cats',$cat_info);
$cat_info = get_option('widget_browse_by_cats');
krsort($cat_info);
foreach($cat_info as $key1=>$val1)
{
	$cat_info_key = $key1;
	if(is_int($cat_info_key))
	{
		break;
	}
}
$advtwidget = array();
$advtwidget = get_option('widget_widget_advtwidget');
$advtwidget[3] = array(
					"title"	=>	'',
					"advt1"	=>	'<a href="http://www.templatic.com"><img alt="" src="'.$dummy_image_path.'i-bannerleft.jpg"></a>',
					
					);
$advtwidget['_multiwidget'] = '1';
update_option('widget_widget_advtwidget',$advtwidget);
$advtwidget = get_option('widget_widget_advtwidget');
krsort($advtwidget);
foreach($advtwidget as $key1=>$val1)
{
	$advtwidget_key = $key1;
	if(is_int($advtwidget_key))
	{
		break;
	}
}
$special_product = array();
$special_product = get_option('widget_widget_special_product');
$special_product[3] = array(
					"title"				=>	'',
					"category"			=>	'',
					"post_number"		=>	'2',
					"post_link"			=>	'',
					);
$special_product['_multiwidget'] = '1';
update_option('widget_widget_special_product',$special_product);
$special_product = get_option('widget_widget_special_product');
krsort($special_product);
foreach($special_product as $key1=>$val1)
{
	$special_product_key = $key1;
	if(is_int($special_product_key))
	{
		break;
	}
}
$recent_info = array();
$recent_info[2] = array(
					"title"				=>	'',
					"number"			=>	'5',
					);
$recent_info['_multiwidget'] = '1';

update_option('widget_recent-posts',$recent_info);
$recent_info = get_option('widget_recent-posts');
krsort($recent_info);
foreach($recent_info as $key1=>$val1)
{
	$recent_info_key = $key1;
	if(is_int($recent_info_key))
	{
		break;
	}
}
$wp_sidebar_widgets["sidebar-7"] = array("browse_by_cats-$cat_info_key","widget_advtwidget-$advtwidget_key","widget_special_product-$special_product_key","recent-posts-$recent_info_key");
$cat_info = array();
$cat_info = get_option('widget_browse_by_cats');
$cat_info[4] = array(
					"title"				=>	'Browse By Category',
					);
$cat_info['_multiwidget'] = '1';

update_option('widget_browse_by_cats',$cat_info);
$cat_info = get_option('widget_browse_by_cats');
krsort($cat_info);
foreach($cat_info as $key1=>$val1)
{
	$cat_info_key = $key1;
	if(is_int($cat_info_key))
	{
		break;
	}
}
$advtwidget = array();
$advtwidget = get_option('widget_widget_advtwidget');
$advtwidget[4] = array(
					"title"	=>	'',
					"advt1"	=>	'<a href="http://www.templatic.com"><img alt="" src="'.$dummy_image_path.'i-bannerleft.jpg"></a>',
					
					);
$advtwidget['_multiwidget'] = '1';
update_option('widget_widget_advtwidget',$advtwidget);
$advtwidget = get_option('widget_widget_advtwidget');
krsort($advtwidget);
foreach($advtwidget as $key1=>$val1)
{
	$advtwidget_key = $key1;
	if(is_int($advtwidget_key))
	{
		break;
	}
}
$special_product = array();
$special_product = get_option('widget_widget_special_product');
$special_product[4] = array(
					"title"				=>	'',
					"category"			=>	'',
					"post_number"		=>	'2',
					"post_link"			=>	'',
					);
$special_product['_multiwidget'] = '1';
update_option('widget_widget_special_product',$special_product);
$special_product = get_option('widget_widget_special_product');
krsort($special_product);
foreach($special_product as $key1=>$val1)
{
	$special_product_key = $key1;
	if(is_int($special_product_key))
	{
		break;
	}
}
$recent_info = array();
$recent_info[3] = array(
					"title"				=>	'',
					"number"			=>	'5',
					);
$recent_info['_multiwidget'] = '1';

update_option('widget_recent-posts',$recent_info);
$recent_info = get_option('widget_recent-posts');
krsort($recent_info);
foreach($recent_info as $key1=>$val1)
{
	$recent_info_key = $key1;
	if(is_int($recent_info_key))
	{
		break;
	}
}
$wp_sidebar_widgets["sidebar-9"] = array("browse_by_cats-$cat_info_key","widget_advtwidget-$advtwidget_key","widget_special_product-$special_product_key","recent-posts-$recent_info_key");
$cat_info = array();
$cat_info = get_option('widget_browse_by_cats');
$cat_info[5] = array(
					"title"				=>	'Browse By Category',
					);
$cat_info['_multiwidget'] = '1';

update_option('widget_browse_by_cats',$cat_info);
$cat_info = get_option('widget_browse_by_cats');
krsort($cat_info);
foreach($cat_info as $key1=>$val1)
{
	$cat_info_key = $key1;
	if(is_int($cat_info_key))
	{
		break;
	}
}
$advtwidget = array();
$advtwidget = get_option('widget_widget_advtwidget');
$advtwidget[5] = array(
					"title"	=>	'',
					"advt1"	=>	'<a href="http://www.templatic.com"><img alt="" src="'.$dummy_image_path.'i-bannerleft.jpg"></a>',
					
					);
$advtwidget['_multiwidget'] = '1';
update_option('widget_widget_advtwidget',$advtwidget);
$advtwidget = get_option('widget_widget_advtwidget');
krsort($advtwidget);
foreach($advtwidget as $key1=>$val1)
{
	$advtwidget_key = $key1;
	if(is_int($advtwidget_key))
	{
		break;
	}
}
$special_product = array();
$special_product = get_option('widget_widget_special_product');
$special_product[5] = array(
					"title"				=>	'',
					"category"			=>	'',
					"post_number"		=>	'2',
					"post_link"			=>	'',
					);
$special_product['_multiwidget'] = '1';
update_option('widget_widget_special_product',$special_product);
$special_product = get_option('widget_widget_special_product');
krsort($special_product);
foreach($special_product as $key1=>$val1)
{
	$special_product_key = $key1;
	if(is_int($special_product_key))
	{
		break;
	}
}
$recent_info = array();
$recent_info[4] = array(
					"title"				=>	'',
					"number"			=>	'5',
					);
$recent_info['_multiwidget'] = '1';

update_option('widget_recent-posts',$recent_info);
$recent_info = get_option('widget_recent-posts');
krsort($recent_info);
foreach($recent_info as $key1=>$val1)
{
	$recent_info_key = $key1;
	if(is_int($recent_info_key))
	{
		break;
	}
}
$wp_sidebar_widgets["sidebar-11"] = array("browse_by_cats-$cat_info_key","widget_advtwidget-$advtwidget_key","widget_special_product-$special_product_key","recent-posts-$recent_info_key");
$cat_info = array();
$cat_info = get_option('widget_browse_by_cats');
$cat_info[6] = array(
					"title"				=>	'Browse By Category',
					);
$cat_info['_multiwidget'] = '1';

update_option('widget_browse_by_cats',$cat_info);
$cat_info = get_option('widget_browse_by_cats');
krsort($cat_info);
foreach($cat_info as $key1=>$val1)
{
	$cat_info_key = $key1;
	if(is_int($cat_info_key))
	{
		break;
	}
}
$advtwidget = array();
$advtwidget = get_option('widget_widget_advtwidget');
$advtwidget[6] = array(
					"title"	=>	'',
					"advt1"	=>	'<a href="http://www.templatic.com"><img alt="" src="'.$dummy_image_path.'i-bannerleft.jpg"></a>',
					
					);
$advtwidget['_multiwidget'] = '1';
update_option('widget_widget_advtwidget',$advtwidget);
$advtwidget = get_option('widget_widget_advtwidget');
krsort($advtwidget);
foreach($advtwidget as $key1=>$val1)
{
	$advtwidget_key = $key1;
	if(is_int($advtwidget_key))
	{
		break;
	}
}
$special_product = array();
$special_product = get_option('widget_widget_special_product');
$special_product[6] = array(
					"title"				=>	'',
					"category"			=>	'',
					"post_number"		=>	'2',
					"post_link"			=>	'',
					);
$special_product['_multiwidget'] = '1';
update_option('widget_widget_special_product',$special_product);
$special_product = get_option('widget_widget_special_product');
krsort($special_product);
foreach($special_product as $key1=>$val1)
{
	$special_product_key = $key1;
	if(is_int($special_product_key))
	{
		break;
	}
}
$recent_info = array();
$recent_info[5] = array(
					"title"				=>	'',
					"number"			=>	'5',
					);
$recent_info['_multiwidget'] = '1';

update_option('widget_recent-posts',$recent_info);
$recent_info = get_option('widget_recent-posts');
krsort($recent_info);
foreach($recent_info as $key1=>$val1)
{
	$recent_info_key = $key1;
	if(is_int($recent_info_key))
	{
		break;
	}
}
$wp_sidebar_widgets["sidebar-13"] = array("browse_by_cats-$cat_info_key","widget_advtwidget-$advtwidget_key","widget_special_product-$special_product_key","recent-posts-$recent_info_key");
$cat_info = array();
$cat_info = get_option('widget_browse_by_cats');
$cat_info[7] = array(
					"title"				=>	'Browse By Category',
					);
$cat_info['_multiwidget'] = '1';

update_option('widget_browse_by_cats',$cat_info);
$cat_info = get_option('widget_browse_by_cats');
krsort($cat_info);
foreach($cat_info as $key1=>$val1)
{
	$cat_info_key = $key1;
	if(is_int($cat_info_key))
	{
		break;
	}
}
$advtwidget = array();
$advtwidget = get_option('widget_widget_advtwidget');
$advtwidget[7] = array(
					"title"	=>	'',
					"advt1"	=>	'<a href="http://www.templatic.com"><img alt="" src="'.$dummy_image_path.'i-bannerleft.jpg"></a>',
					
					);
$advtwidget['_multiwidget'] = '1';
update_option('widget_widget_advtwidget',$advtwidget);
$advtwidget = get_option('widget_widget_advtwidget');
krsort($advtwidget);
foreach($advtwidget as $key1=>$val1)
{
	$advtwidget_key = $key1;
	if(is_int($advtwidget_key))
	{
		break;
	}
}
$special_product = array();
$special_product = get_option('widget_widget_special_product');
$special_product[7] = array(
					"title"				=>	'',
					"category"			=>	'',
					"post_number"		=>	'2',
					"post_link"			=>	'',
					);
$special_product['_multiwidget'] = '1';
update_option('widget_widget_special_product',$special_product);
$special_product = get_option('widget_widget_special_product');
krsort($special_product);
foreach($special_product as $key1=>$val1)
{
	$special_product_key = $key1;
	if(is_int($special_product_key))
	{
		break;
	}
}
$recent_info = array();
$recent_info[6] = array(
					"title"				=>	'',
					"number"			=>	'5',
					);
$recent_info['_multiwidget'] = '1';

update_option('widget_recent-posts',$recent_info);
$recent_info = get_option('widget_recent-posts');
krsort($recent_info);
foreach($recent_info as $key1=>$val1)
{
	$recent_info_key = $key1;
	if(is_int($recent_info_key))
	{
		break;
	}
}
$wp_sidebar_widgets["sidebar-15"] = array("browse_by_cats-$cat_info_key","widget_advtwidget-$advtwidget_key","widget_special_product-$special_product_key","recent-posts-$recent_info_key");
$cat_info = array();
$cat_info = get_option('widget_browse_by_cats');
$cat_info[8] = array(
					"title"				=>	'Browse By Category',
					);
$cat_info['_multiwidget'] = '1';

update_option('widget_browse_by_cats',$cat_info);
$cat_info = get_option('widget_browse_by_cats');
krsort($cat_info);
foreach($cat_info as $key1=>$val1)
{
	$cat_info_key = $key1;
	if(is_int($cat_info_key))
	{
		break;
	}
}
$text_info = array();
$text_info[1] = array(
					"title"				=>	'Payment Method',
					"text"				=>	'<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam,  justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam  ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo  porttitor.</p>',
					);
$text_info['_multiwidget'] = '1';

update_option('widget_text',$text_info);
$text_info = get_option('widget_text');
krsort($text_info);
foreach($text_info as $key1=>$val1)
{
	$text_info_key = $key1;
	if(is_int($text_info_key))
	{
		break;
	}
}
$wp_sidebar_widgets["sidebar-17"] = array("browse_by_cats-$cat_info_key","text-$text_info_key");
$cart_info = array();
$cart_info[1] = array(
					"title"				=>	'Shopping Cart',
					);
$cart_info['_multiwidget'] = '1';

update_option('widget_shopping_cart_info',$cart_info);
$cart_info = get_option('widget_shopping_cart_info');
krsort($cart_info);
foreach($cart_info as $key1=>$val1)
{
	$cart_info_key = $key1;
	if(is_int($cart_info_key))
	{
		break;
	}
}
$wp_sidebar_widgets["sidebar-28"] = array("shopping_cart_info-$cart_info_key");
update_option('sidebars_widgets',$wp_sidebar_widgets);
/////////////// WIDGET SETTINGS END ///////////////
}
}
////////////////////////////////////////////////////////////////
///IF YOU DON'T WANT DEFAULT DATA/DUMMY DATA INSERT CODE, PLEASE REMOVE THIS CODE
////////////DUMMY DATA INSERT CODE START////
function autoinstall_admin_header()
{
	global $wpdb;
	if('themes.php' == basename($_SERVER['SCRIPT_FILENAME']) && $_REQUEST['template']=='' && $_GET['page']=='') 
	{
	if($_REQUEST['dummy']=='del')
	{
		delete_dummy_data();	
		$dummy_deleted = '<p><b>All Dummy data has been removed from your database successfully!</b></p>';
	}
	if($_REQUEST['dummy_insert'])
	{
		require_once (CHILDTEMPLATEPATH . '/auto_install.php');
	}
	if($_REQUEST['activated']=='true')
	{
		$theme_actived_success = '<p class="message">Theme activated successfully.</p>';	
	}
	$post_counts = $wpdb->get_var("select count(post_id) from $wpdb->postmeta where (meta_key='pt_dummy_content' || meta_key='tl_dummy_content') and meta_value=1");
	if($post_counts>0)
	{
		$dummy_data_msg = '<p> <b>Sample data has been populated on your site. Wish to delete sample data?</b> <br />  <a class="button_delete" href="'.get_option('siteurl').'/wp-admin/themes.php?dummy=del">Yes Delete Please!</a><p>';
	}else
	{
		$dummy_data_msg = '<p> <b>Would you like to auto install this theme and populate sample data on your site?</b> <br />  <a class="button_insert" href="'.get_option('siteurl').'/wp-admin/themes.php?dummy_insert=1">Yes, insert sample data please</a></p>';
	}
	
	
	$theme_active_message = '
	<style>
	.highlight { width:60% !important; background:#FFFFE0 !important; overflow:hidden; display:table; border:2px solid #558e23 !important; padding:15px 20px 0px 20px !important; -moz-border-radius:11px  !important;  -webkit-border-radius:11px  !important;   } 
	.highlight p { color:#444 !important; font:15px Arial, Helvetica, sans-serif !important; text-align:center;  } 
	.highlight p.message { font-size:13px !important; }
	.highlight p a { color:#ff7e00; text-decoration:none !important; } 
	.highlight p a:hover { color:#000; }
	.highlight p a.button_insert 
		{ display:block; width:230px; margin:10px auto 0 auto;  background:#5aa145; padding:10px 15px; color:#fff; border:1px solid #4c9a35; -moz-border-radius:5px;  -webkit-border-radius:5px;  } 
	.highlight p a:hover.button_insert { background:#347c1e; color:#fff; border:1px solid #4c9a35;   } 
	.highlight p a.button_delete 
		{ display:block; width:140px; margin:10px auto 0 auto; background:#dd4401; padding:10px 15px; color:#fff; border:1px solid #9e3000; -moz-border-radius:5px;  -webkit-border-radius:5px;  } 
	.highlight p a:hover.button_delete { background:#c43e03; color:#fff; border:1px solid #9e3000;   } 
	#message0 { display:none !important;  }
	
	
	</style>
	<div class="updated highlight fade"> '.$theme_actived_success.$dummy_deleted.$dummy_data_msg.'</div>';
	echo $theme_active_message;	
	}
}
add_action("admin_head", "autoinstall_admin_header"); // please comment this line if you wish to DEACTIVE SAMPLE DATA INSERT.

function delete_dummy_data()
{
	global $wpdb;
	delete_option('sidebars_widgets'); //delete widgets
	$productArray = array();
	$pids_sql = "select p.ID from $wpdb->posts p join $wpdb->postmeta pm on pm.post_id=p.ID where (meta_key='pt_dummy_content' || meta_key='tl_dummy_content') and meta_value=1";
	$pids_info = $wpdb->get_results($pids_sql);
	foreach($pids_info as $pids_info_obj)
	{
		wp_delete_post($pids_info_obj->ID);
	}
}

/*add_action('wp_footer', 'footer_script_add');
function footer_script_add()
{
	if($_REQUEST['ptype']=='login' && $_REQUEST['emsg']=='')
	{
		echo '<script>showhide_registration();</script>';
	}
}*/
////////////DUMMY DATA INSERT CODE END////
function customSliderPromo($args){
	extract($args);
	$option = get_option('customSliderProm');
	$no_posts = $option['promo_slides'];
	$order_by= $option['order_by'];
	?>
    <script src="<?php  echo get_bloginfo('template_directory').'/library/js/jquery.min.js' ?>"></script>
    <script src="<?php  echo get_bloginfo('template_directory').'/library/js/slides.min.jquery.js'; ?>"></script>
        <script type="text/javascript">
		jQuery.noConflict();
		jQuery(function(){
			jQuery('#slides').slides({
				preload: true,
  				preloadImage: '<?php  echo get_bloginfo('template_directory') ?>/images/ajax-loader.gif',
				play: <?php echo $option['promo_speed']; ?>,
				pause: <?php echo $option['promo_pause'] ?>,
				hoverPause: true,
				effect: 'fade, fade',
				crossfade: true
			});
		});
	</script>
    <div id="slides">
  <div class="slides_container">
    <?php
	global $post;
	$args = array( 'post_type' => '	promotion_slide', 'posts_per_page' => $no_posts,'order'=>$order_by );
	$latest_posts = new WP_Query( $args );
	    while ( $latest_posts->have_posts() ) : $latest_posts->the_post();
		?>
    	<div><?php echo get_the_content(); ?></div>
	    <?php
		endwhile;
		?>
  	 </div>
     <span class="curve lt"></span>
     <span class="curve rt"></span>
     <span class="curve lb"></span>
     <span class="curve rb"></span>
	</div>   
    
    <?php
}
function CustomSlidePromoControl(){
	$data = get_option('customSliderProm');
	$select1 = $data['order_by']=="ASC" ? 'selected="selected"':'';
	$select2 = $data['order_by']!="ASC" ? 'selected="selected"':'';
	?>
  <p><label>Number of Slides</label><input name="promo_slides" type="text" value="<?php echo $data['promo_slides']; ?>" class="widefat" /></p>
  <p><label>Slide Speed <span>(default 5000 milleseconds)</span></label><input name="promo_speed" type="text" value="<?php echo $data['promo_speed']; ?>" class="widefat" /></p>
  <p><label>Slide Pause <span>(default 2500 milleseconds)</span></label><input name="promo_pause" type="text" value="<?php echo $data['promo_pause']; ?>" class="widefat" /></p>
  <p><label>Order By</label>
  <select name="order_by">
  <option value="1"<?php echo $select1; ?>>Ascending</option>
  <option value="2" <?php echo $select2; ?>>Descending</option>
  </select>
  </p>
<?php 
if(isset($_POST['promo_slides'])){
	$data['promo_slides']= attribute_escape($_POST['promo_slides']);
	$data['order_by']= $_POST['order_by']==1 ? "ASC" : "DESC";
	$data['promo_speed']= $_POST['promo_speed']=="" ? "5000" : $_POST['promo_speed'];
	$data['promo_pause']= $_POST['promo_pause']=="" ? "2500" : $_POST['promo_pause'];
	update_option('customSliderProm',$data);
}
}
wp_register_sidebar_widget('10','Custom Promotion Slider','customSliderPromo');
wp_register_widget_control('10','Custom Promotion Slider','CustomSlidePromoControl');
add_action( 'init', 'promo_new_post_type' );
function promo_new_post_type() {
	register_post_type( 'promotion_slide',
		array(
			'labels' => array(
				'name' => __( 'Promotion Slider' ),
				'singular_name' => __( 'Promotion Slider' )
			),
			'public' => true,
			'has_archive' => true,
			'rewrite' => array('slug' => 'promotionslider')
		)
	);
}
if(!get_option("medium_crop")){
    add_option("medium_crop", "1");}
else{    update_option("medium_crop", "1");}
	
function SimpleImageWidget($args){
	extract($args);
	$option = get_option('SimpleImageWidgetdata');
	if($option['link']!=''){
		echo '<a href="'.$option['link'].'" target="'.$option['target'].'"><img src="'.$option['src'].'" alt="" title="" width="'.$option['width'].'" height="'.$option['height'].'" /></a>';
	}
	else{
		echo '<img src="'.$option['src'].'" alt="" title="" width="'.$option['width'].'" height="'.$option['height'].'" />';
	}
	
}
function SimpleImageWidgetControl(){
	$img_data = get_option('SimpleImageWidgetdata');
	?>
	<p><label>Image src</label><input type="text" class="widefat" name="src" value="<?php echo $img_data['src']; ?>" /></p>
   	<p><label>Image width</label><input type="text" class="widefat" name="width" value="<?php echo $img_data['width']; ?>" /></p>
   	<p><label>Image height</label><input type="text" class="widefat" name="height" value="<?php echo $img_data['height']; ?>" /></p>
   	<p><label>Image link</label><input type="text" class="widefat" name="link" value="<?php echo $img_data['link']; ?>" /></p>
    <p><label>Image link target</label><input type="text" class="widefat" name="target" value="<?php echo $img_data['target']; ?>" /></p>
	<?php
	if(isset($_POST['src'])){
	$img_data['src'] = $_POST['src'];
	$img_data['width'] = $_POST['width'];
	$img_data['height'] = $_POST['height'];
	$img_data['link'] = $_POST['link'];
	$img_data['target'] = $_POST['target'];
	update_option('SimpleImageWidgetdata',$img_data);
	}
}
wp_register_sidebar_widget('11','Image Widget','SimpleImageWidget');
wp_register_widget_control('11','Image Widget','SimpleImageWidgetControl');

function my_function_admin_bar($content) {
    return ( current_user_can("administrator") ) ? $content : false;
}
add_filter( 'show_admin_bar' , 'my_function_admin_bar');

add_action('admin_init', 'no_mo_dashboard');
function no_mo_dashboard() {
  if (!current_user_can('manage_options') && $_SERVER['DOING_AJAX'] != '/wp-admin/admin-ajax.php') {
  wp_redirect(site_url()); exit;
  }
}

?>
